perm filename TEST1.TEX[JSM,TEX] blob
sn#569433 filedate 1981-02-27 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 \input basic
C00004 ENDMK
Cā;
\input basic
\font t=cmtt
\def\tt{\:t}
\vskip 12pt
It is not hard to obtain
{/it qualitative} statements about the amount
of coding saved and the amount of time lost when
subroutines are used. Suppose that a piece of coding
requires $k$ locations and that it appears in $m$
places in the pro-gram.
Rewriting this as a subroutine, we need
an extra instruction
{\tt STJ}
and an exit line for the subroutine,
plus a single
{\tt JMP}
instruction in each of the $m$ places
where the subroutine is called. This gives a total
of $m+k+2$ locations, rather than $mk$,
so the amount saved is
$$(m-1)(k-1)-3.\eqno(2)$$
If $k$ is 1 or $m$ is 1 we cannot possibly
save any space by using subroutines; this,
of course, is obvious. If $k$ is 2, $m$ must be
greater than 4 in order to gain, etc.
\vfill\end